import * as Types from './mutations-types'

const mutations = {
    // state是自动放入的，默认就是指的当前的state
    // [Types.INCREMENT]意思是取出Types里的INCREMENT值
    [Types.INCREMENT] (state, count) {
        // 传过来的参数不是数值型则返回
        if (isNaN(count)) {
        return
        }
        state.count += count
    },
    [Types.DECREMENT] (state, count) {
        if (isNaN(count)) {
        return
        }
        state.count -= count
    }
}

export default mutations;